package com.ayf.payment.game.api.Template;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.thymeleaf.TemplateEngine;
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;

/**
 * @Description:
 * @Author: zh-liang
 * @Date : 2020-03-26 20:14
 */
@Configuration
public class TemplateConfig {
    @Bean
    public TemplateEngine templateEngine() {
        ClassLoaderTemplateResolver classLoaderTemplateResolver = new ClassLoaderTemplateResolver();
        classLoaderTemplateResolver.setPrefix("/templates/");
        classLoaderTemplateResolver.setSuffix(".html");
        classLoaderTemplateResolver.setCacheable(false);
        classLoaderTemplateResolver.setCharacterEncoding("utf-8");
        TemplateEngine engine = new TemplateEngine();
        engine.setTemplateResolver(classLoaderTemplateResolver);
        return engine;
    }
}
